{% extends 'dashboard/base.html' %}

{% load i18n %}
{% load materializecss %}
{% load staticfiles %}

{% block title %}
  {% if location.pk %}
    {{ location }}
  {% else %}
    {% trans "Add new stock location" context "Stock location page title" %}
  {% endif %}
   - {% trans "Stock location" context "Dashboard stock location" %} - {{ block.super }}
{% endblock %}

{% block body_class %}body-locations{% endblock %}

{% block header_extra %}
  {% if location.pk %}
    <a class="dropdown-button right" href="#" data-activates="attribute-delete" data-constrainwidth="false">
      <svg data-src="{% static "dashboard/images/more_vert.svg" %}" height="24" width="24" />
    </a>
    <ul id="attribute-delete" class="dropdown-content">
      <li>
        <a class="modal-trigger-custom" href="#base-modal"
        data-href="{% url 'dashboard:product-stock-location-delete' location.pk %}">
          {% trans "Remove location" context "Stock location detail action" %}
        </a>
      </li>
    </ul>
  {% endif %}
{% endblock %}

{% block breadcrumbs %}
  <ul class="breadcrumbs breadcrumbs--history">
    <li>
      <a href="{% url 'dashboard:product-stock-location-list' %}" class="breadcrumbs--ellipsed-item">
        {% trans "Stock location" context "Dashboard stock location" %}
      </a>
    </li>
    <li class="back-mobile">
      <a href="{% url 'dashboard:sale-list' %}">
        <svg data-src="{% static "dashboard/images/arrow_left.svg" %}" fill="#fff" width="20px" height="20px" />
      </a>
    </li>
    <li>
      <span class="breadcrumbs--ellipsed-item">
        {% if location.pk %}
          {{ location }}
        {% else %}
          {% trans "Add new stock location" context "Stock location detail breadcrumbs" %}
        {% endif %}
      </span>
    </li>
  </ul>
{% endblock %}

{% block menu_location_class %} active{% endblock %}

{% block content %}
  <div class="row">
    <div class="col s12 l9">
      <div class="card">
        <form method="post" id="form-product" novalidate>
          <div class="card-content card-content-form">
            {% csrf_token %}
            <div class="row">
              {{ form.name|materializecss }}
            </div>
          </div>
          <div class="card-action right-align">
            {% if location.pk %}
              <a href="{% url 'dashboard:product-stock-location-list' %}" class="btn btn-flat">
                {% trans "Cancel" context "Dashboard cancel action" %}
              </a>
              <button type="submit" class="btn waves-effect waves-light">
                {% trans "Update" context "Dashboard update action" %}
              </button>
            {% else %}
              <a href="{% url 'dashboard:product-stock-location-list' %}" class="btn btn-flat">
                {% trans "Cancel" context "Dashboard cancel action" %}
              </a>
              <button type="submit" class="btn waves-effect waves-light">
                {% trans "Create" context "Dashboard create action" %}
              </button>
            {% endif %}
          </div>
        </form>
      </div>
    </div>
    <div class="col m12 l3 help-box"></div>
  </div>
{% endblock %}
